<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        h1 {
            font-size: 100px;
            text-align: center;
        }

        .divs {
            height: 20px;
            width: 150px;
            margin: 0 auto;
            position: relative;
        }

        .begin {
            position: absolute;
            height: 100px;
            width: 200px;
            background: violet;
            border: none;
            font-size: 50px;
        }

        .end {
            position: absolute;
            height: 100px;
            width: 200px;
            background: violet;
            border: none;
            display: none;
            font-size: 50px;
        }

    </style>
</head>
<body>

<div>
    <div class="text">
        <h1>名字</h1>
    </div>
    <div class="divs">
        <button class="begin">开始</button>
        <button class="end">停止</button>
    </div>

</div>
<script>
    let begin = document.querySelector('.begin')
    let end = document.querySelector('.end')
    let countdown = document.querySelector('h1')

    let arr = ["刘帅军", "聂奥义", "靳历龙", "何永哲", "陈茜", "黄晓霞", "楚佳佳", "冯世豪", "项世豪", "项阔", "房闺蜜", "房火"]
    console.log(arr, length)

    let t;
    begin.onclick = () => {
        clearInterval(t)
        t = setInterval(() => {
            countdown.innerHTML = countdown.innerHTML = arr[random(0, arr.length-1)]
            end.style.display = 'block'
            begin.style.display = 'none'
        }, 10)
    }
    end.onclick = () => {
        clearInterval(t)
        begin.style.display = 'block'
        end.style.display = 'none'
    }


    function random(max, min) {
        return Math.round(Math.random() * (max - min) + min);
    }

</script>
</body>
</html>